package com.teng.smartdrawer.fragments;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.teng.smartdrawer.R;
import com.teng.smartdrawer.adapter.RecommendAdapter;
import com.teng.smartdrawer.bean.Part;
import com.teng.smartdrawer.bean.Recommend;
import com.teng.smartdrawer.utils.EffectConstants;
import com.teng.smartdrawer.view.FlashView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by teng on 16/2/22.
 */
public class FoundFragment extends Fragment{

    private List<Recommend> mData = new ArrayList<Recommend>();
    //private SwipeRefreshLayout mRefreshLayout;


    @Override
    public void onAttach(Context context) {
        super.onAttach(context);

    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View ret = inflater.inflate(R.layout.found_fragment , null);
        //mRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.main_refreshlayout);
        //mRefreshLayout.setOnRefreshListener(this);
//        mListView = (PullToRefreshListView) ret.findViewById(R.id.main_loadmore_listview);
        //mListView.setOnLoadMoreListener(this);

        View advertisement =  inflater.inflate(R.layout.advertisement, null);
        FlashView flashView = (FlashView) advertisement.findViewById(R.id.flash_view);

        List<String> imageUrls=new ArrayList<String>();
        imageUrls.add("http://pica.nipic.com/2007-11-09/200711912453162_2.jpg");
        imageUrls.add("http://www.bz55.com/uploads1/allimg/120312/1_120312100435_8.jpg");
        imageUrls.add("http://img3.iqilu.com/data/attachment/forum/201308/21/192654ai88zf6zaa60zddo.jpg");
        imageUrls.add("http://img2.pconline.com.cn/pconline/0706/19/1038447_34.jpg");
        imageUrls.add("http://7xlamq.com2.z0.glb.qiniucdn.com/pub_19360034_1455876912966_3120-4160_1080");

        flashView.setImageUris(imageUrls);
        flashView.setEffect(EffectConstants.DEPTH_PAGE_EFFECT);//更改图片切换的动画效果

        for (int i = 0; i < 50; i++) {
            Part part = new Part();
            part.setId(Long.parseLong(i+""));
            mData.add(part);
        }

        RecommendAdapter mAdapter = new RecommendAdapter(getContext() , mData);
//        mListView.setAdapter(mAdapter);
//        mListView.getRefreshableView().addHeaderView(advertisement);

        return ret;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

}
